package com.gxa.hystrix.interfaces;

import com.gxa.hystrix.pojo.GuaHaoJiLu;
import com.gxa.hystrix.pojo.HuanZheJiuZhenKa;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author thinknovo
 * @version 1.0
 * @description ServiceFeignByCheck.java
 * @date 2021/3/11 9:23
 */
// 此接口与feign中定义的接口一样，直接迁移过来即可
// 调用一个子服务模块，需要在注解中指定，名字由client的yml文件定义
@FeignClient(value = "EUREKA-CLIENT-GUAHAO01")
public interface ServiceFeignByCheck {
    /*
    这里需要几个要点：
    1.这里定义的路径作用是调用client中的接口
    2.这里的method即是只定义了get，在feign还是会检查client是否允许post请求，如果没有post请求将报错
    3.@RequestParam(value = "name")是绑定controller中的形式参数名，如果没有value属性定义也会报错
     */
    @RequestMapping(value = "/user/selectAll",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map selectClient(@RequestParam(value = "yongHuMingCheng") String yongHuMingCheng);

    @RequestMapping(value = "/yiSheng/chaXunYiSheng",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map chaXunYiSheng(@RequestParam(name = "id") String id,@RequestParam(name = "yiShengLeiXing") String yiShengLeiXing);

    @RequestMapping(value = "/huanZheJiuZhenKa/chaXunAll", method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map huanZheJiuZhenKaChaXunAll();

    @RequestMapping(value = "/huanZheJiuZhenKa/gengXinById", method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map huanZheJiuZhenKaGengXinById(@RequestBody HuanZheJiuZhenKa huanZheJiuZhenKa);

    @RequestMapping(value = "/huanZheJiuZhenKa/chaXunByKaHao", method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map huanZheJiuZhenKaChaXunByKaHao(@RequestParam(name = "huanZheKaHao",required = false) String huanZheKaHao,
                      @RequestParam(name = "shenFenZheng",required = false) String shenFenZheng,
                      @RequestParam(name = "xingMing",required = false) String xingMing,
                      @RequestParam(name = "shouJiHao",required = false) String shouJiHao,
                      @RequestParam(name = "kaiShiShiJian",required = false) String kaiShiShiJian,
                      @RequestParam(name = "jieShuShiJian",required = false) String jieShuShiJian);

    @RequestMapping(value = "/keShi/chaXunAll", method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map chaXunKeShi();

    @RequestMapping(value = "/guaHaoJiLu/chaXunAll", method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map guaHaoJiLuChaXunAll();

    @RequestMapping(value = "/guaHaoJiLu/gengXinById", method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map guaHaoJiLuGengXinById(@RequestBody GuaHaoJiLu guaHaoJiLu);

    @RequestMapping(value = "/guaHaoJiLu/tuiHaoById", method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map guaHaoJiLuTuiHaoById(@RequestParam(name = "id") String id);

    @RequestMapping(value = "/guaHaoJiLu/xinZeng", method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map guaHaoJiLuXinZeng(@RequestBody GuaHaoJiLu guaHaoJiLu);

}
